//filename: ipscopetbl.h

#ifndef __IPSCOPE_TBL_H_
#define __IPSCOPE_TBL_H_

#include <stdlib.h>
#include "idmgr.h"

struct ipscope{
	struct ipscope *m_next;
	int m_id;
	int m_flag;
	u_int32_t m_start;
	u_int32_t m_end;
};

typedef struct ipscopetable{
	int m_num;
	struct ipscope *m_head;
	struct id_mgr_table m_id_mgr;
}ipscope_table;

void	init_ipscope_table(ipscope_table* list);
void 	clear_ipscope_table(ipscope_table* list);
int	add_ipscope2(ipscope_table* list, u_int32_t start, u_int32_t end,int flag);
int add_ipscope(ipscope_table* list, u_int32_t start, u_int32_t end,int flag);
int	delete_ipscope(ipscope_table* list, int id);
int	get_ipscope(ipscope_table* list, int id, u_int32_t* start, u_int32_t* end);
int	export_ipscope_table(const ipscope_table* list, struct ipscope* tbl, int nmax);
int unite_add_ipscope_table(const ipscope_table* table1, ipscope_table* table2, int max,  int flag=2);

void	print_ipscope_table(const ipscope_table* list);

#endif
